#include "common.h"

void quicksort(vector<int>& nums, int start, int end)
{
	if (start >= end) return;
	int basic = nums[start];
	int i = start;
	int j = end;
	while (i < j)
	{
		while (nums[j] > basic && i < j) j--;
		nums[i] = nums[j];
		while (nums[i] <= basic && i < j) i++;
		nums[j] = nums[i];
	}
	nums[i] = basic;
	quicksort(nums, start, i - 1);
	quicksort(nums, i + 1, end);
}
void sortColors(vector<int>& nums)
{
	quicksort(nums, 0, nums.size() - 1);
}